
import mapview from './common/mapview.js'
import GlobalConst from './common/globalConst.js'
var global = GlobalConst.GlobalConst;
import layermng from './layer/layermng.js'
import SymbolManger from './symbol/symbolmanager.js'
import TopoManager from './topo/topomanager.js'
import transactionmngsvc from './service/transactionmngsvc.js'

import LXCOM from './common/common.js'
import { LGXEnums } from './common/sysenum.js';

import utilfuncs from './common/tools/utilfuncs.js';
var funcs = utilfuncs.UtilFuncs;

import animatemanager from './animate/animatemanager.js'
import { KeyGenerator } from './common/keygenerator.js'

import auxdatamanager from './datamng/auxdatamanager.js';


import { LineCoordCorrectSvc } from './graph/action/correct/linecoordcorrectsvc.js';

class DataManger {
    constructor(mapwid, maphgt, worldMapRect, editMode) {
        this.mapViewInfo = new mapview.MapViewParam(mapwid, maphgt, worldMapRect, editMode);
        this._curentGraph = null;
        this._toolKind = 0x02010000;
        this.m_pXLastAbsorbGraph = null;
        this.m_pYLastAbsorbGraph = null;
        this.m_LayerMng = new layermng.LayerManger();
        this.switchLayer("");
        this.m_symbolManger = new SymbolManger.SymbolManger();
        this.m_topoManager = new TopoManager.TopoManager();
        this.m_pOperStepService = new transactionmngsvc.TransactionMngSvc(this);
        this.m_tReshViewRectLst = new Array();

        this.m_tPreLightGraphLst = new Array();
        this.m_tSelectGraphLst = new Array();
        this.m_tBorderGraphLst = new Array();
        this.m_tAmitationGraphLst = new Array();//动态变化的图形队列
        this.mapWorkMode = "";//主工作模式，如：绘图、编辑、漫游、标注、浏览.....
        this.mapEditMode = LGXEnums.EditMode.normal; //子编辑模式，如修剪、删除、镜像、位移....
        this.subDimensionMode = LGXEnums.SubDimensionMode.dimLine;//标注主工作模式下，子标注类型，如线性标注、角度标注
        this.multiModifyMode = false;
        this.m_tCurentNewGraphLst = new Array();
        this.m_tThisTimeStoreNewGraphLst = new Array();
        this.m_pMulSelRectGraph = null;
        this.m_tAllSymbolDefLst = new Array();
        this.m_pAnimateManager = new animatemanager.AnimateManager();

        this.pickPoint = new LXCOM.LGXPoint();
        this.editModeRelateInfoArr = [];
        this.m_AuxDataManager = new auxdatamanager.AuxDataManager(LGXEnums.EditMode.normal);

        this.m_finalUnitList = null;
        this.tSearchNodeStack = null;
        this.m_fillTopoErrorUnitList = null;
        this.m_flashTime = 0;
        this.m_pDragTempGraphList = [];
        this.canvasScreenRect = { left: 0, top: 0, right: 0, bottom: 0 };
        this.mouseDragFlag = false;
        this.operStepStartFlag = false;
        this._preSelGraph = null;
    }

    resizeMap(wid, hgt) {
        this.mapViewInfo.resizeMap(wid, hgt);
    }

    getSubDataMngs() {
        let subDataMngLst = [];
        subDataMngLst.push(this.m_AuxDataManager);
        return subDataMngLst;
    }

    getSubEditMngByMode(subEditMode) {
        let subEditMng = null;
        switch (subEditMode) {
            case LGXEnums.EditMode.mirror:
                break;

            case LGXEnums.EditMode.rotate:
                break;

            case LGXEnums.EditMode.extend:
                break;

            case LGXEnums.EditMode.translate:
                break;

            case LGXEnums.EditMode.scale:
                break;
        }

        return subEditMng;
    }

    setTool(kind,symbolUUID) {
        this._toolKind = kind;
        this._toolSymbolUUID = symbolUUID;
        this.mapWorkMode = LGXEnums.LGXWorkMode.DrawGraphMode;
        this.mapEditMode = LGXEnums.EditMode.normal;
    }
    getTool() { return this._toolKind; }
    getToolSymbolUUID() { return this._toolSymbolUUID; }

    setMapWorkMode(mode) {
        if (mode == "") {
            console.log("error mode *****************");
        }
        this.mapWorkMode = mode;
        this.mapEditMode = LGXEnums.EditMode.normal;
    }
    getMapWorkMode() { return this.mapWorkMode; }

    setEditMode(mode) {
        this.mapWorkMode = LGXEnums.LGXWorkMode.ModifyMode;
        this.mapEditMode = mode;
        let obj = this.getEditModeObj(mode);
        if (!obj) {
            this.setEditModeRelateValue(mode, 10);
        }
        let rst = null;
        let subEditMng = this.getSubEditMngByMode(mode);
        if (subEditMng) {
            rst = subEditMng.start(this);
        }
        return rst;
    }
    getEditMode() { return this.mapEditMode; }

    getMapViewInfo() { return this.mapViewInfo; }
    setScaling(s) { this.mapViewInfo.setScaling(s); }
    getScaling() { return this.mapViewInfo.getScaling(); }

    getMapScale() { return this.mapViewInfo.getMapScale(); }
    setMapScale(s) { this.mapViewInfo.setMapScale(s); }

    setCurentGraph(g) {
        this._preSelGraph = this._curentGraph;
        this._curentGraph = g;
    }
    getCurentGraph() { return this._curentGraph; }
    getPreSelGraph() { return this._preSelGraph; }

    getYLastAbsorbGraph() { return this.m_pYLastAbsorbGraph; }
    getXLastAbsorbGraph() { return this.m_pXLastAbsorbGraph; }
    getLayerManager() { return this.m_LayerMng; }
    getTopoManager() { return this.m_topoManager; }
    getSymbolManager() { return this.m_symbolManger; }
    setMultiModifyMode(v) { this.multiModifyMode = v; }
    getMultiModifyMode() { return this.multiModifyMode; }
    setMulSelRectGraph(v) { this.m_pMulSelRectGraph = v; }
    getMulSelRectGraph() { return this.m_pMulSelRectGraph; }
    getAnimateManager() { return this.m_pAnimateManager; }
    getAllSymbolDefLst() { return this.m_tAllSymbolDefLst; }
    getAuxDataManager() { return this.m_AuxDataManager; }

    switchLayer(name) {
        let tmp = name.trim();
        let destLayer = null;
        let len = tmp.length;
        if (len == 0) {
            destLayer = this.m_LayerMng.getCurentLayer();
        }
        else {
            destLayer = this.m_LayerMng.switchLayer(tmp);
        }
        if (destLayer) {
            this.m_pCurentLayer = destLayer;
        }
    }

    initSymbol2Mem(tAllSymbolUnitLst, tAllSymbolDefLst) {
        this.m_tAllSymbolDefLst.length = 0;
        this.m_symbolManger.initSymbol2Mem(tAllSymbolUnitLst, tAllSymbolDefLst);
        for (let i = 0; i < tAllSymbolDefLst.length; i++) {
            let symbol = tAllSymbolDefLst[i];
            this.m_tAllSymbolDefLst.push(symbol);
        }
    }


    productGraph(toolKind) {
        let symbol = this.getSymbol(toolKind, 0);
        var pNewGraph = this.m_pCurentLayer.generateGraph(toolKind, symbol, this.mapViewInfo.backColor);
        if (pNewGraph) {
            this.addCurentNewGraph(pNewGraph);
            pNewGraph.addObserver(this);

            if (this.getMapViewInfo().editMode != "autocad") {
                let coorCorrectSvc = this.getCoordCorrectSvc(pNewGraph);
                if (coorCorrectSvc) {
                    pNewGraph.setCoordCorrectSvc(coorCorrectSvc);
                }
            }
        }
        return pNewGraph;
    }

    createGraph4DataInit(layerName, toolKind) {
        let layer = this.m_LayerMng.findLayer(layerName);
        if (!layer) {
            layer = this.m_LayerMng.getCurentLayer();
        }
        let symbol = this.getSymbol(toolKind, 0);
        var pNewGraph = layer.generateGraph(toolKind, symbol, this.mapViewInfo.backColor);
        if (pNewGraph) {
            pNewGraph.addObserver(this);
        }
        return pNewGraph;
    }

    creatNewGraph4InnerSvc(toolKind) {
        let pNewGraph = this.productGraph(toolKind);
        if (pNewGraph) {
            pNewGraph.setFinish(1);
            pNewGraph.setUseful(1);
            pNewGraph.setStart(1);
            pNewGraph.setNewAdd(1);
            pNewGraph.m_gid = KeyGenerator.gid();
        }
        return pNewGraph;
    }

    chkCanStartNewGraph() {
        var flag = false;
        var pCurentGraph = this._curentGraph;
        if ((pCurentGraph != null && pCurentGraph.getFinish() == 1)//已经绘制完成
            || pCurentGraph == null//未开始
            || (pCurentGraph != null && pCurentGraph.getUseful() == 0)//已开始，但是图形对象无效
        ) {
            flag = true;
        }
        return flag;
    }

    pickGraph(tPoint, picktype, pickTopFlag) {
        return this.m_LayerMng.pickGraph(tPoint, this.mapViewInfo, picktype, pickTopFlag);
    }


    recordRefreshScope(rect) {
        var pRect = new LXCOM.LGXRect();
        pRect.clone(rect);
        this.m_tReshViewRectLst.push(pRect);
    }

    recordRepaintScope(graph) {
        if (this.mapViewInfo.editMode != 'autocad')
        {
            let scaling = this.getScaling();
            let ptlist = graph.getScopeVertexPtLst(scaling);
            let rect = funcs.calPtListZone(ptlist);
            this.m_tReshViewRectLst.push(rect);
        }
        this.m_tReshViewRectLst.push(graph.getZone());
        if (graph.getTopoRes()){
            let connOtherGraphs = graph.getDirectConnOther();
            connOtherGraphs.forEach(t => {
                this.m_tReshViewRectLst.push(t.getZone());
            });
        }
    }

    calRefreshRect(){
        if (this.m_tReshViewRectLst.length == 0){
            return null;
        }
        let count = this.m_tReshViewRectLst.length;
        let rereshZone = new LXCOM.LGXRect();
        let rect = this.m_tReshViewRectLst[0];
        rereshZone.clone(rect);

        for (let i = 1;i <  count;i++){
            rect = this.m_tReshViewRectLst[i];
            rereshZone.left = Math.min(rereshZone.left,rect.left);
            rereshZone.right = Math.max(rereshZone.right,rect.right);
            rereshZone.top = Math.max(rereshZone.top,rect.top);
            rereshZone.bottom = Math.min(rereshZone.bottom,rect.bottom);
        }
        let gap = 10/this.getScaling();
        rereshZone.expand(gap);
        return rereshZone;
    }

    getAllGraphs() {
        var list = new Array();
        this.m_LayerMng.appendGraph2Lst(list);
        return list;
    }

    getAllVisibleGraphs() {
        let list = [];
        this.m_LayerMng.appendGraph2Lst(list);
        let validList = [];
        list.forEach(p => {
            if (p.getUseful() == 1) {
                validList.push(p);
            }
        });
        return validList;
    }

    getTopoList() {
        var list = new Array();
        this.m_topoManager.appendTopo2List(list);
        return list;
    }

    setAbsorbRayLine(kind, graph) {
        var list = new Array();
        if (kind == 1) {
            //x坐标对齐射线
            if (this.m_pXLastAbsorbGraph) {
                this.m_pXLastAbsorbGraph.setHighLight(0);
                list.push(this.m_pXLastAbsorbGraph.getZone());
            }

            if (graph) {
                graph.setHighLight(1);
                this.m_pXLastAbsorbGraph = graph;
                list.push(this.m_pXLastAbsorbGraph.getZone());
            }
        }
        else if (kind == 2) {
            //y坐标对齐射线
            if (this.m_pYLastAbsorbGraph) {
                this.m_pYLastAbsorbGraph.setHighLight(0);
                list.push(this.m_pYLastAbsorbGraph.getZone());
            }

            if (graph) {
                graph.setHighLight(1);
                this.m_pYLastAbsorbGraph = graph;
                list.push(this.m_pYLastAbsorbGraph.getZone());
            }
        }
        return list;
    }

    getSymbol(symbolUUID, state) {
        return this.m_symbolManger.getSymbol(symbolUUID, state);
    }

    getSymbolByType(type,state){
        return this.m_symbolManger.getSymbolByType(type, state);
    }

    clearData() {
        this.m_LayerMng.clearData();
        this.m_topoManager.clearData();
        let subMngLst = this.getSubDataMngs();
        subMngLst.forEach(subMng => {
            subMng.clearData();
        });
        this.m_symbolManger.clearExSymbols();
        this.clearTempData();
    }

    clearFreshZone() {
        this.m_tReshViewRectLst.length = 0;
    }

    clearTempData() {
        this.clearMemCurentDatas();
        this.clearMultiSelDatas();
        let list = this.getSubDataMngs();
        list.forEach(ele => {
            ele.resetEditMode(this);
        });
    }

    clearMemCurentDatas() {
        var pCurentSelGraph = this.getCurentGraph();
        if (pCurentSelGraph) {
            pCurentSelGraph.setFinish(1);
            pCurentSelGraph.setHighLight(0);
            pCurentSelGraph.setModifing(0);
            pCurentSelGraph.setSelect(0);
            pCurentSelGraph.setSelKind(0);
            this.recordRepaintScope(pCurentSelGraph);
        }

        var lightKind = 0;
        this.LightGraphInList(lightKind, this.m_tSelectGraphLst);
        this.LightGraphInList(lightKind, this.m_tBorderGraphLst);
        this.LightGraphInList(lightKind, this.m_tPreLightGraphLst);
        this.setCurentGraph(null);
    }

    clearMultiSelDatas() {
        this.clearMemCurentDatas();
        for (var idx in this.m_tSelectGraphLst) {
            var pGraph = m_tSelectGraphLst[idx];
            pGraph.setModified(0);
            pGraph.setHighLight(0);
            this.recordRepaintScope(pGraph);
        }

        for (var idx in this.m_tBorderGraphLst) {
            var pGraph = m_tBorderGraphLst[idx];
            pGraph.setModified(0);
            pGraph.setHighLight(0);
            this.recordRepaintScope(pGraph);
        }
    }

    LightGraphInList(lightKind, tGraphList) {
        var nGraph = tGraphList.length;
        if (lightKind == 1)//点亮
        {
            for (let i = 0; i < nGraph; i++) {
                var pLight = tGraphList[i];
                var nIn = this.m_tPreLightGraphLst.indexOf(pLight);
                if (nIn == -1) {
                    pLight.setHighLight(1);
                    this.recordRepaintScope(pLight);
                    this.m_tPreLightGraphLst.push(pLight);
                }
            }
        }
        else //熄灭
        {
            for (let i = nGraph - 1; i >= 0; i--) {
                pLight = tGraphList[i];
                pLight.setHighLight(0);
                pLight.setModifing(0);
                pLight.setSelect(0);
                pLight.setSelKind(0);
                this.recordRepaintScope(pLight);
                tGraphList.splice(i, 1);
            }
        }
    }

    lightGraph(lightKind, graph) {
        if (lightKind == 1)//点亮
        {
            let nIn = this.m_tPreLightGraphLst.indexOf(graph);
            if (nIn == -1) {
                graph.setHighLight(1);
                this.recordRepaintScope(graph);
                this.m_tPreLightGraphLst.push(graph);
            }
        }
        else //熄灭
        {
            this.LightGraphInList(0, this.m_tSelectGraphLst);
            this.LightGraphInList(0, this.m_tBorderGraphLst);
            this.LightGraphInList(0, this.m_tPreLightGraphLst);
        }
    }

    notifySelect(graph, select) {
        if (!graph) {
            return;
        }
        if (select) {
            this.add2SelectList(graph);
        }
        else {
            this.removeFromSelectList(graph);
        }
        this.recordRepaintScope(graph);
    }

    add2SelectList(graph) {
        if (this.m_tSelectGraphLst.indexOf(graph) == -1) {
            this.m_tSelectGraphLst.push(graph);
        }
    }

    getIndexInSelectList(graph) { return this.m_tSelectGraphLst.indexOf(graph); }
    getSelectCount() { return this.m_tSelectGraphLst.length; }
    getGraphInSelectList(i) { return this.m_tSelectGraphLst[i]; }
    clearSelectList() {
        let list = this.m_tSelectGraphLst;
        list.forEach(t => {
            t.forseSetSelect(0);
            t.setHighLight(0);
        });
        var len = this.m_tSelectGraphLst.length;
        this.m_tSelectGraphLst.splice(0, len);
        this.m_tSelectGraphLst.length = 0;
    }
    removeFromSelectList(graph) {
        var idx = this.m_tSelectGraphLst.indexOf(graph);
        if (idx >= 0) {
            this.m_tSelectGraphLst.splice(idx, 1);
        }
    }

    getSelGraphs() {
        var arr = new Array();
        var count = this.getSelectCount();
        for (let i = 0; i < count; i++) {
            var p = this.getGraphInSelectList(i);
            arr.push(p);
        }
        var curentGraph = this.getCurentGraph();
        if (curentGraph && arr.indexOf(curentGraph) == -1) {
            arr.push(curentGraph);
        }
        return arr;
    }

    getBoder() { return this.m_tBorderGraphLst; }
    add2BordeList(graph) { this.m_tBorderGraphLst.push(graph); }
    getIndexInBorderList(graph) { return this.m_tBorderGraphLst.indexOf(graph); }
    getBorderCount() { return this.m_tBorderGraphLst.length; }

    getGraphInBorderList(i) {
        if (i >= 0 && i < m_tBorderGraphLst.length) {
            return m_tBorderGraphLst[i];
        }
        else {
            return null;
        }
    }

    clearBorderList() {
        var len = this.m_tBorderGraphLst.length;
        this.m_tBorderGraphLst.splice(0, len);
        this.m_tBorderGraphLst.length = 0;
    }

    findGraph(gid) {
        var pGraph = null;
        if (gid != 0) {
            pGraph = this.m_LayerMng.findGraph(gid);
        }
        else {
            pGraph = this.getCurentGraph();
        }
        return pGraph;
    }

    findGraphByRID(rid) {
        var pGraph = null;
        if (rid != 0) {
            pGraph = this.m_LayerMng.findGraphByRID(rid);
        }
        return pGraph;
    }

    getRelateTopo(pGraph, tRelateRes, tRelateGph) {
        let topoRes = pGraph.getTopoRes();
        if (topoRes) {
            this.m_topoManager.getRelateTopo(topoRes, tRelateRes, tRelateGph);
        }
        if (tRelateGph.indexOf(pGraph) == -1) {
            tRelateGph.push(pGraph);
        }
    }

    addCurentNewGraph(p) {
        if (this.m_tCurentNewGraphLst.indexOf(p) == -1) {
            this.m_tCurentNewGraphLst.push(p);
        }
    }
    getCurentNewGraphLst() { return this.m_tCurentNewGraphLst; }

    setEditModeRelateValue(mode, val) {
        let dstModeObj = this.getEditModeObj(mode);
        if (!dstModeObj) {
            dstModeObj = { mode, value: val, state: 0 };
            this.editModeRelateInfoArr.push(dstModeObj);
        }
        dstModeObj.value = val;
    }

    getEditModeRelateValue(mode) {
        let rst = 10;
        let dstModeObj = this.getEditModeObj(mode);
        if (dstModeObj) {
            rst = parseFloat(dstModeObj.value);
        }
        return rst;
    }

    setEditModeState(mode, state) {
        let dstModeObj = this.getEditModeObj(mode);
        if (!dstModeObj) {
            dstModeObj = { mode, value: 0, state: state };
            this.editModeRelateInfoArr.push(dstModeObj);
        }
        dstModeObj.state = state;
    }

    getEditModeState(mode) {
        let state = null;
        let dstModeObj = this.getEditModeObj(mode);
        if (dstModeObj) {
            state = dstModeObj.state;
        }
        return state;
    }

    getEditModeObj(mode) {
        let dstModeObj = null;
        this.editModeRelateInfoArr.forEach((p) => {
            if (p.mode == mode) {
                dstModeObj = p;
                return;
            }
        });
        return dstModeObj;
    }

    notifyGraphUpdate(obj, delflag) {
        //console.log("graph data chg&&&&&&&&&&&&&&&&&&&&&&&");
        //console.log(obj);
        //数据发生变动通知标注数据管理层
        if (this.mapViewInfo.editMode == "autocad") {
            this.m_DimDataManager.notifyGraphUpdate(obj, delflag);
        }
    }

    notifyNewGraphFinish(graph) {
        if (this.mapViewInfo.editMode == "autocad") {
            this.m_DimDataManager.notifyNewGraph(this, graph)
        }
    }



    setFillTopoErrorUnitList(errorList) {
        this.m_flashTime = 0;
        this.m_fillTopoErrorUnitList = errorList;
        // window.loopHandle = window.requestAnimationFrame(window.animateLoopCalBack);
    }

    getFillTopoErrorUnitList() {
        return this.m_fillTopoErrorUnitList;
    }

    clearFillTopoErrorUnitList() {
        this.m_fillTopoErrorUnitList = null;
        // window.cancelAnimationFrame(window.loopHandle);
    }

    getMultiSelFlag() {
        let flag = false;
        if (this.m_tSelectGraphLst.length > 1) {
            flag = true;
        }
        return flag;
    }

    getGraphOnDestPoint(mousePoint) {
        let destGraph = this.pickGraph(mousePoint);
        if (!destGraph) {
            console.log("chk point on graph feature");
        }
        return destGraph;
    }

    getSymbolDef(typeID) {
        let dstSymbol = null;
        let list = this.m_tAllSymbolDefLst;
        for (let i = 0; i < list.length; i++) {
            let symbol = list[i];
            if (symbol.type == typeID) {
                dstSymbol = symbol;
                break;
            }
        }
        return dstSymbol;
    }

    chkDBClickOnPackageHotZone(mousePoint) {
        let destContainerGraph = null;
        let tAlllGraphList = this.getAllGraphs();
        let count = tAlllGraphList.length;
        for (let i = 0; i < count; i++) {
            let pGraph = tAlllGraphList[i];
            let symbol = pGraph.getSymbol();
            if (symbol) {
                let moldActionType = symbol.getMoldActionType();
                if (moldActionType == LGXEnums.moldActionType.packege) {
                    let rect = pGraph.getZone();
                    if (funcs.chkPtInRect(mousePoint, rect)
                        && pGraph.chkClickOnHotZone(mousePoint)) {
                        destContainerGraph = pGraph;
                        break;
                    }
                }
            }
        }
        return destContainerGraph;
    }

    getSelRectPosition() {
        if (this.m_pMulSelRectGraph != null) {
            return this.m_pMulSelRectGraph.getPosCopy();
        }
        return null;
    }

    // unit = { type: 0x03342121, name: '剪去直角和圆角的矩形2', iconURL: '/res/icon/0x03342121.png', category: "base-unit" };

    notify2GetTool(type) {
        let toolTypeList = [];

        let curentSymDef = null;
        this.m_tAllSymbolDefLst.forEach(unit => {
            if (unit.type == type) {
                curentSymDef = unit;
                return;
            }
        });

        if (!curentSymDef) {
            return [];
        }
        let destCategory = curentSymDef.category;
        this.m_tAllSymbolDefLst.forEach(unit => {
            if (unit.category == destCategory) {
                toolTypeList.push(unit);
            }
        });
        return toolTypeList;
    }

    resetFileMode(editMode) {
        this.mapViewInfo.editMode = editMode;
    }

    getCoordCorrectSvc(graph) {
        let svc = null;
        switch (graph.m_graphType) {
            case LGXEnums.LGXGraphType.LineGraph_type:
                svc = new LineCoordCorrectSvc(this);
                break;
        }
        return svc;
    }

    resetMapScreenPos(screenLeft, screenTop, screenRight, screenBottom) {
        this.canvasScreenRect.left = screenLeft;
        this.canvasScreenRect.top = screenTop;
        this.canvasScreenRect.right = screenRight;
        this.canvasScreenRect.bottom = screenBottom;
    }

    getCanvasScreenRect() { return this.canvasScreenRect; }

    setDragFlag(v) {
        this.mouseDragFlag = v;
    }

    getDragFlag() {
        return this.mouseDragFlag;
    }

    setOperStepStartFlag(v) {
        this.operStepStartFlag = v;
    }

    getOperStepStartFlag() {
        return this.operStepStartFlag;
    }

    pickGraph4Edge(mousePoint) {
        let destGraph = null;
        let scaling = this.mapViewInfo.getScaling();
        let pickList = this.m_LayerMng.pickAllGraphsOnPoint(mousePoint, this.mapViewInfo);
        if (pickList) {
            if (pickList.length == 1) {
                destGraph = pickList[0];
            }
            else if (pickList.length > 1) {
                pickList.forEach(graph => {
                    if (graph.chPtOnEdge(mousePoint, scaling)) {
                        destGraph = graph;
                        return;
                    }
                });
            }
        }
        return destGraph;
    }

}

export default { DataManger }
